fix(selectors): drain Snowflake result partitions - #7357
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR updates Snowflake server selectors to drain all advertised result partitions atomically while retaining the runtime tool’s existing single-response behavior.
Confidence Score: 5/5The PR appears safe to merge, with the partition-draining path bounded and fail-closed while preserving caller cancellation and existing runtime behavior. The changed selector validates every partition before returning options, rejects incomplete or inconsistent aggregate results, and maintains independent per-response and aggregate resource limits without exposing a concrete correctness or security failure.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/selectors/server/providers/snowflake.ts | Adds bounded, ordered partition draining with consistent error mapping, cancellation preservation, and aggregate validation. |
| apps/sim/tools/snowflake/utils.ts | Extends response parsing with optional abort propagation and shared aggregate byte-budget accounting without changing default callers. |
| apps/sim/lib/selectors/server/providers/snowflake.test.ts | Covers ordered multi-partition results, all-or-nothing failure, later-fetch cancellation, and invalid initial metadata. |
| apps/sim/tools/snowflake/utils.test.ts | Verifies successful shared-budget accounting and rejection after aggregate budget exhaustion. |
Sequence Diagram
sequenceDiagram
participant S as Selector
participant API as Snowflake SQL API
S->>API: POST statement
API-->>S: Partition 0, handle, metadata
loop Each advertised later partition
S->>API: GET statement handle and partition number
API-->>S: Ordered partition rows
S->>S: Validate status, handle, limits, and budget
end
S->>S: Verify aggregate row count
S-->>S: Build all-or-nothing selector options
Reviews (1): Last reviewed commit: "fix(selectors): drain Snowflake result p..." | Re-trigger Greptile
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Re-trigger cubic
Summary
Type of Change
Testing
bun run --cwd apps/sim test lib/selectors/server/providers/snowflake.test.ts tools/snowflake/utils.test.ts(34 tests passed)bunx biome check apps/sim/lib/selectors/server/providers/snowflake.ts apps/sim/lib/selectors/server/providers/snowflake.test.ts apps/sim/tools/snowflake/utils.ts apps/sim/tools/snowflake/utils.test.tsbun run --cwd apps/sim type-checkReview focus: ordered all-or-nothing partition draining, aggregate limits, cancellation, and unchanged runtime tool behavior.
Checklist
Screenshots/Videos
Not applicable; server-side selector behavior only.